package hongcaosp.app.android.modle.impl;

import android.text.TextUtils;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams;

import hongcaosp.app.android.BuildConfig;
import hongcaosp.app.android.modle.BaseResponse;
import hongcaosp.app.android.modle.DataCallBack;
import hongcaosp.app.android.modle.bean.Pagebean;
import hongcaosp.app.android.modle.bean.UserInfo;
import hongcaosp.app.android.modle.bean.Video;
import hongcaosp.app.android.modle.mi.SearchModle;

public class SearchModleImpl implements SearchModle {
    @Override
    public void searchVideoResult(String token, String content, int pageSize, int pageNumber, DataCallBack<Pagebean<Video>> dataCallBack) {
        HttpParams params = new HttpParams();
        if (!TextUtils.isEmpty(token)) {
            params.put("token", token);
        }
        params.put("content", content);
        params.put("pageSize", pageSize);
        params.put("pageNumber", pageNumber);
        params.put("type", 1);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/searchResult").params(params).execute(dataCallBack);
    }

    @Override
    public void searchUserResult(String token, String content, int pageSize, int pageNumber, DataCallBack<Pagebean<UserInfo>> dataCallBack) {
        HttpParams params = new HttpParams();
        if (!TextUtils.isEmpty(token)) {
            params.put("token", token);
        }
        params.put("content", content);
        params.put("pageSize", pageSize);
        params.put("pageNumber", pageNumber);
        params.put("type", 2);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/searchResult").params(params).execute(dataCallBack);
    }
}
